<!DOCTYPE html>
<html lang="en">
<head>

    <meta charset="UTF-8">
    <!--适应移动端-->
    <meta name="viewport" content="width=device-width,initial-scale=1.0 ">
    <title>巨人的风车-博客发布</title>
    <link rel="stylesheet" th:href="@{/Semantic-UI-2.4.1/dist/semantic.min.css}">
    <link rel="stylesheet" th:href="@{/css/me.css}">
    <link rel="stylesheet" th:href="@{/lib/editor.md-master/css/editormd.min.css}">
    <link rel="stylesheet" th:href="@{/css/typo.css}">
<!--    <link href="https://unpkg.com/@wangeditor/editor@latest/dist/css/style.css" rel="stylesheet">-->
    <style>
        #editor—wrapper {
            border: 1px solid #ccc;
            z-index: 0.5 !important; /* 按需定义 */
        }
        #toolbar-container { border-bottom: 1px solid #ccc; }
        #editor-container { height: 400px; }
    </style>

<!--    <link rel="stylesheet" type="text/css" href="/static/css/font-awesome-4.7.0/css/font-awesome.min.css">-->
    <!--图标-->
    <link rel='stylesheet prefetch' href='https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.4.1/components/icon.min.css'>
</head>
<body>
<!--导航-->
 <nav class="ui inverted attached segment m-padded-tb-mini m-shadow-small ">
     <div class="ui container">
         <div class="ui inverted secondary stackable menu">
             <h2 class="ui teal header item">博客发布</h2>
             <a th:href="@{/admin/blog}" class="active m-item item m-mobile-hide"><i class="home icon"></i>博客</a>
             <a th:href="@{/admin/types}" class="m-item item m-mobile-hide"><i class="idea icon"></i>分类</a>
             <a th:href="@{/admin/tags}" class="m-item item m-mobile-hide"><i class="tags icon"></i>标签</a>
             <a th:href="@{/admin/pinglun}" class="m-item item m-mobile-hide"><i class="tags icon"></i>评论</a>
             <div class="right m-item m-mobile-hide menu">
                 <div class="ui dropdown item">
                     <div class="text">
                         <img th:src="@{/images/ren.jpg}" alt="" class="ui avatar image">
                         曾豪杰
                     </div>
                     <i class="dropdown icon"></i>
                     <div class="menu">
                         <a th:href="@{/admin/logout}" class="item">注销</a>
                     </div>
                 </div>
             </div>
<!--             <div class="right m-item item m-mobile-hide">-->
<!--                <div class="ui icon inverted transparent input">-->
<!--                    <input type="text" placeholder="Search...">-->
<!--                    <i class="search icon"></i>-->
<!--                </div>-->
<!--             </div>-->
         </div>
     </div>
     <a href="#" class="ui menu toggle black icon button m-right-top m-mobile-show">
         <i class="sidebar icon"></i>
     </a>
     <!--引入隐藏背景资源-->
     <img th:src="@{/images/beijing.jpg}" class="m-hidden" alt="">
 </nav>
<div class="ui attached pointing menu">
    <div class="ui container">
        <div class="right menu">
            <a th:href="@{/admin/input}" class="teal active item">发布</a>
            <a th:href="@{/admin/blog}" class=" item">列表</a>
        </div>
    </div>
</div>

<!--中间内容-->
 <div class="m-container m-padded-tb-big">
        <div class="ui container">
            <form id="blog-form" action="#" th:object="${blog}" th:action="@{/admin/blogs}" class="ui form" method="post">
                <input type="hidden" name="published">
                <input type="hidden" name="id" th:value="*{id}">
                <div class="required field">
                    <div class="ui left labeled input">
                        <div class="ui selection compact teal basic dropdown label">
                            <input type="hidden" value="1" name="flag" th:value="*{flag}">
                            <i class="dropdown icon"></i>
                            <div class="text"  data-value="0">原创</div>
                            <div class="menu">
                                <div class="item" data-value="0">原创</div>
                                <div class="item" data-value="2">转载</div>
                                <div class="item" data-value="3">翻译</div>
                            </div>
                        </div>
                        <input type="text" name="title" placeholder="标题" th:value="*{title}">
                    </div>
                </div>

<!--                <div class="required field">-->
<!--                    <div id="md-content" style="z-index: 1 !important;">-->
<!--                        &lt;!&ndash;富文本&ndash;&gt;-->
<!--                        <div id="editor—wrapper">-->
<!--                            <div id="toolbar-container">&lt;!&ndash; 工具栏 &ndash;&gt;</div>-->
<!--                            <div id="editor-container"  >&lt;!&ndash; 编辑器 &ndash;&gt;</div>-->
<!--                            <textarea  id="text1" name="content" placeholder="博客内容" ></textarea>-->
<!--                        </div>-->
<!--                    </div>-->

<!--                </div>-->
                <div class="required field">
                    <div id="md-content" style="z-index: 1 !important;">
                        <textarea name="content" class="typo js-toc-content typo-selection" placeholder="博客内容" th:text="*{content}"></textarea>
                        [TOC]
                        #### Disabled options

                        - TeX (Based on KaTeX);
                        - Emoji;
                        - Task lists;
                        - HTML tags decode;
                        - Flowchart and Sequence Diagram;

                        #### Editor.md directory

                        editor.md/
                        lib/
                        css/
                        scss/
                        tests/
                        fonts/
                        images/
                        plugins/
                        examples/
                        languages/
                        editormd.js
                        ...

                        ```html
                    </div>
                </div>

                <div class="two fields">
                    <div class="required field">
                        <div class="ui left labeled action input">
                            <label class="ui compact teal basic label">分类</label>
                            <div class="ui fluid selection dropdown">
                                <input type="hidden" name="types.id" th:value="*{type}">
                                <i class="dropdown icon"></i>
                                <div class="default text">分类</div>
                                <div class="menu">
                                    <div class="item" th:each="type:${types}" th:data-value="${type.id}" th:text="${type.name}">--</div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="required field">
                        <div class="ui left labeled action input">
                            <label class="ui compact teal basic label">标签</label>
                            <div class="ui tag fluid selection multiple search dropdown">
                                <input type="hidden" name="tagIds" th:value="*{tagIds}">
                                <i class="dropdown icon"></i>
                                <div class="default text">标签</div>
                                <div class="menu">
                                    <div class="item" th:each="tag:${tags}" th:data-value="${tag.id}" th:text="${tag.name}">--</div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

                <div class="required field">
                    <div class="ui left labeled input">
                        <label class="ui teal basic label">首图</label>
                        <input type="text" name="firstPicture" th:value="*{firstPicture}" placeholder="首图引用地址">
                    </div>
                </div>

                <div class="required field">
                    <textarea name="description"  th:text="*{description}" placeholder="博客描述" maxlength="200"></textarea>
                </div>

                <div class="inline fields">
                    <div class="field">
                        <input style="width:20px;height:20px" checked th:checked="*{recommend}" type="checkbox" name="recommend" value="1" /><p style="width:50px;height:80px;color: yellow">推荐</p>
                        <input style="width:20px;height:20px" th:checked="*{shareStatement}" type="checkbox" name="shareStatement" value="1"/><p style="width:70px;height:80px;color: yellow">转载声明</p>
                        <input style="width:20px;height:20px" th:checked="*{appreciation}" type="checkbox" name="appreciation" value="1"/><p style="width:50px;height:80px;color: yellow">赞赏</p>
                        <input style="width:20px;height:20px" th:checked="*{comment}" type="checkbox" name="comment" value="1"/><p style="width:50px;height:80px;color: yellow">评论</p>
<!--                        <div class="ui checkbox">-->
<!--                            <input type="checkbox" name="recommend" id="recommend"  class="hidden">-->
<!--                            <label for="recommend">推荐</label>-->
<!--                        </div>-->
<!--                        <div class="ui checkbox">-->
<!--                            <input type="checkbox" name="shareStatement" id="shareStatement" class="hidden">-->
<!--                            <label for="shareStatement">转载声明</label>-->
<!--                        </div>-->
<!--                        <div class="ui checkbox">-->
<!--                            <input type="checkbox" name="appreciation" id="appreciation" class="hidden">-->
<!--                            <label for="appreciation">赞赏</label>-->
<!--                        </div>-->
<!--                        <div class="ui checkbox">-->
<!--                            <input type="checkbox" name="comment" id="comment" class="hidden">-->
<!--                            <label for="comment">评论</label>-->
<!--                        </div>-->
                    </div>
                </div>

                <div class="ui error message"></div>

                <div class="ui right aligned container">
                    <button class="ui button" type="button" onclick="window.history.go(-1)">返回</button>
                    <button  type="button" id="save-btn" class="ui secondary button">保存</button>
                    <button type="button" id="publish-btn" class="ui teal button">发布</button>
                </div>
            </form>
        </div>
 </div>

<!--底部footer-->
<footer class="ui inverted vertical segment m-padded-tb-massive">
    <div class="ui center aligned container">
        <div class="ui inverted divided stackable grid">
            <div class="three wide column">
                <h4 class="ui inverted header m-text-thin m-text-spaced  m-opacity-mini">海天梦离</h4>
                <div class="ui inverted link list">
                    <div class="item">
                        <img th:src="@{/images/picfooter.png}" class="ui rounded image" alt="" style="width: 110px">
                    </div>
                </div>
            </div>
            <div class="three wide column">
                <h4 class="ui inverted header m-text-thin m-text-spaced  m-opacity-mini">最新博客</h4>
                <div id="newBlog-container">
                    <div class="ui inverted link list" th:fragment="newBlogList">
                        <a href="#" th:href="@{/blog/{id}(id=${blog.id})}" target="_blank" class="item m-text-lined" th:each="blog:${newblogs}" th:text="${blog.title}">用户故事</a>
                    </div>
                </div>

            </div>
            <div class="three wide column">
                <h4 class="ui inverted header m-text-thin m-text-spaced  m-opacity-mini">联系我</h4>
                <div class="ui inverted link list">
                    <p href="#" class="item m-text-lined" th:text="#{qq}">QQ:1965411732</p>
                    <p href="#" class="item m-text-lined" th:text="#{email}">email:1965411732@qq.com</p>
                    <a href="https://gitee.com/Azenghaojie/myblogs/tree/master"  class="item m-text-lined" >前往git开源仓库</a>
                </div>
            </div>
            <div class="seven wide column">
                <h4 class="ui inverted header m-text-thin m-text-spaced  m-opacity-mini">博客</h4>
                <p class="m-text-thin m-text-spaced m-opacity-mini" th:text="#{info}">此博客为Dreamchaser追梦的个人博客。在这里，记录了我的技术博客，记录了我的经 验分享，也记录了我生活的点滴，记录了我的成长。我特别喜欢一个词，那就是"追梦"，这也是我昵称的由来，同时也是我和我的团队筹备的一款app的名字 。人生在世，必然会有自己的梦想，不论这个梦想是大是小，是遥不可及还是触手可得，你所要坚信的便只有一件事——有梦便一定要去追，我们都该是追梦人！不论现在处境如何，我们都要去拼一拼，不试怎么知道你会不会成功呢？愿大家都能以梦为马，不负青春韶华！</p>
            </div>
        </div>
        <div class="ui inverted section divider"> </div>
        <p class="m-text-thin m-text-spaced m-opacity-mini">Copyright © 2022 杰</p>
        <br>
        <a href="https://beian.miit.gov.cn/" target="_blank">渝ICP备2025066220号-1</a>
    </div>
</footer>

<script th:src="@{/js/jquery-3.5.1.min.js}"></script>
<script th:src="@{/Semantic-UI-2.4.1/dist/semantic.min.js}"></script>
<script th:src="@{/lib/editor.md-master/editormd.min.js}"></script>
<script th:src="@{/lib/prism/prism.js}"></script>
<script>
    $('#newBlog-container').load(/*[[@{/footer/newBlog}]]*/"/footer/newBlog");
</script>
<script>
    //初始化Markdown编辑器
    var contentEditor;
    $(function () {
        contentEditor = editormd({
            id:"md-content",
            width: "100%",
            height: 640,
            syncScrolling: "single",
            path: "/lib/editor.md-master/lib/"
        });
    });
    $('.menu.toggle').click(function () {
        $('.m-item').toggleClass('m-mobile-hide');
    });
    $('.ui.dropdown').dropdown({
        on:'hover'
    })
    $('.ui.tag.dropdown').dropdown({
        allowAdditions:true
    })
    $('.ui.form').form({
        fields:{
            title:{
                identifier: 'title',
                rules:[{
                    type:'empty',
                    prompt:'标题：请输入博客标题'
                }]
            },
            content:{
                identifier: 'content',
                rules:[{
                    type:'empty',
                    prompt:'请输入博客内容'
                }]
            },
            tagIds:{
                identifier: 'tagIds',
                rules:[{
                    type:'empty',
                    prompt:'请输入博客标签'
                }]
            },
            description:{
                identifier: 'description',
                rules:[{
                    type:'empty',
                    prompt:'请输入博客描述信息'
                }]
            },
            flag:{
                identifier: 'flag',
                rules:[{
                    type:'empty',
                    prompt:'请输入博客flag信息'
                }]
            },
            firstPicture:{
                identifier: 'firstPicture',
                rules:[{
                    type:'empty',
                    prompt:'请输入博客引用图片'
                }]
            }
        }
    })
    $('#save-btn').click(function () {
        $('[name="published"]').val(2);
        $('#blog-form').submit();
    });
    $('#publish-btn').click(function () {
        $('[name="published"]').val(1);
        $('#blog-form').submit();
    });
</script>
<!--<input type="file" accept="image/*" multiple="" style="display: none;">-->
</body>
</html>
